//
//  UIButton+Extension.m
//  WeiBo
//
//  Created by 小小罗 on 15/11/25.
//  Copyright © 2015年 RealMadrid. All rights reserved.
//

#import "UIButton+Extension.h"

@implementation UIButton (Extension)
+ (UIButton *)initWithImageName:(NSString *)imageName backGroundImageName:(NSString *)backGroundImageName{
    
    UIButton *button = [[UIButton alloc] init];
    
    [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:[imageName stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
    [button setBackgroundImage:[UIImage imageNamed:backGroundImageName] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:[backGroundImageName stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
    
    return  button;
}

+ (UIButton *)initWithTitle:(NSString *)title color:(UIColor *)color backImageName:(NSString *)backImageName{
    UIButton *button = [[UIButton alloc] init];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:color forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:backImageName] forState:UIControlStateNormal];
    
    
    return button;
}

@end
